
<%--
    Document   : index
    Created on : 5/Jun/2009, 5:42:11
    Author     : eurico
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="deti.es.ukni.cm.account.AccountBean"%>
<%@page import="deti.es.ukni.persistence.entity.*" %>
<%@page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

 <%
    AccountBean curAccount = (AccountBean) session.getAttribute("account");
 %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../../resource/myband.css" />
        <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA-IxVtEF80D4xYMtKixTl9xTwM0brOpm-All5BF6PoaKBxRWWERTJYYYTq_EhpUWmZOadEtkHw-UC6Q"></script>

        <title>JSP Page</title>
    </head>
    <body>
                <div id="header">
            <div id="logo">
                <img src="../../resource/mybandlogo.png" alt="myband_logo"/>
            </div>
        </div>

        <div id="nav">
            <% if ( curAccount == null ){ %>
            <ul>
                <li><a href="../../account/login.jsp">Login</a></li>
                <li><a href="../../account/new.jsp">Create account</a></li>
                <li><a href="../../band">Search Bands</a> </li>
            </ul>
            <%}else{%>
            <a href="../../account/logout.jsp">Logout</a>
            <ul>
                <li><a href="../../account">Account</a></li>
                <li> <a href="../../band">Friends</a></li>
                <li><a href="../../band">Your favorite bands</a></li>
                <li><a href="../../band">Search Bands</a> </li>
                <% if (curAccount.hasBand() ){ %>
                <li><a href="../new.jsp">My Band</a> </li>
                <% } %>
            </ul>
            <%}%>
        </div>
        <div id="content">
 <%
        Integer IDBand = Integer.parseInt(request.getParameter("id"));
        Band band = AccountBean.findBand(IDBand);
        if ( band == null )
            response.sendError( response.SC_NOT_FOUND );
%>

            <div class="bands">

                <h2>Band details!</h2>
                <div class="view">
                    <ul>
                        <li><a href="events.jsp?id=<%= IDBand %>">View Events</a></li>
                        <li><a href="videos.jsp?id=<%= IDBand %>">View Videos</a></li>
                    </ul>
                </div>

                <div class="band">
                    <span class="name"> <%= band.getName() %></span>
                    <%
                    boolean following = false;
                    int count = 0;
                    if ( curAccount != null ){
                        Set<Band> follow = curAccount.getAccount().getBandCollection();
                        for ( Band b: follow){
                            if ( IDBand.equals(b.getIdband()) ){
                                following = true;
                                break;
                            }
                        }
                    }
                    %>
                    <span class="followers">Has <%= band.getAccountCollection().size() %> follower(s)</span><br/>
                    <%= curAccount == null || following == true ? "": "<a class=\"startfollow\"href=\"../follow?id=" + band.getIdband().toString() +"\">follow</a>"%>
                    <h3>Band description</h3>
                    <blockquote>
                        <%= "&#8220;" + band.getDescription() + "&#8221;" %>
                    </blockquote>
                    <h3>Band biography</h3>
                    <blockquote>
                        <%= "&#8220;" + band.getBiography() + "&#8221;" %>
                    </blockquote>
                    <h2>Band Elements</h2>
                    <%

                    Set<Bandelement> bandelements = AccountBean.getBandElements(IDBand);
                    if ( bandelements != null ){
                        for( Bandelement be: bandelements){
                        %>
                        <div class="belement">
                        <span class="bename"> <%= be.getName() %> </span>
                        <span class="berole"> <%= be.getRole() %> </span>
                    <blockquote>
                        <%= "&#8220;" + be.getBiography() + "&#8221;" %>
                    </blockquote>
                        </div>
                    <% }
                     }else{%>
                     <h3>Has no elements!</h3>
                     <%}%>
                </div>
            </div>
        </div>
    </body>
</html>
